Skip to content

Fix SL.io.50: Avoid endl.#2323

Closed
lettersdigits wants to merge 1 commit intoisocpp:masterfrom
lettersdigits:patch-1
Closed

Fix SL.io.50: Avoid endl.#2323
lettersdigits wants to merge 1 commit intoisocpp:masterfrom
lettersdigits:patch-1

Conversation

@lettersdigits
Copy link
Copy Markdown

Adds wording that makes it clear that usually, replacing std::endl with '\n' is a good idea, but that there are rare cases, for instance when using std::cout, where flushing is important.

An example of that encountered in practice that caused a bug when changing from std::endl to '\n' (not mentioned in the commit changes) is:

Flushing std::cout (or some other stream that does not always automatically in all configurations flush upon \n), as part of checking assumptions and printing the results of checking, just before potentially crashing.

Adds wording that makes it clear that usually, replacing `std::endl` with `'\n'` is a good idea, but that there are rare cases, for instance when using `std::cout`, where flushing is important.

An example of that encountered in practice that caused a bug when changing from `std::endl` to `'\n'` (not mentioned in the commit changes) is:

Flushing `std::cout` (or some other stream that does not always automatically in all configurations flush upon `\n`), as part of checking assumptions and printing the results of checking, just before potentially crashing.
@hsutter
Copy link
Copy Markdown
Contributor

hsutter commented Apr 16, 2026

Editors call: Thanks! We've reviewed your suggestion and we understand the nuance, but we think the current wording covers what we want to say here as simply as possible.

@hsutter hsutter closed this Apr 16, 2026
@hsutter hsutter self-assigned this Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants